package com.stlm2.controller.transfer;

import com.stlm2.core.base.BaseController;
import com.stlm2.dems.transfer.service.TransferService;
import com.stlm2.util.codecontent.CodeContent;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

/**
 * Created by zlq on 2017/8/11.
 */
@Controller
@RequestMapping("/transferC")
public class TransferController extends BaseController {
    @Resource
    private TransferService transferService;

    /*zlq
*查询所有用户的转账记录页面
* */
    @ResponseBody
    @RequestMapping(value="/list",produces="application/json;charset=UTF-8")
    public ModelAndView listView(ModelAndView modelAndView){
        modelAndView.setViewName("/withdraw/bankRecord");
        return modelAndView;
    }

    /*
*zlq
* 查询所有用户的转账记录
* @param  token
* @param  page:页码
* @param  userName:转款账户
* @param  stateValue:状态值
* @param  toUserName:收款账户
* @param  code：编码
*
 */
    @ResponseBody
    @RequestMapping(value="/getAllTransferRecord",produces="application/json;charset=UTF-8")
    public String getAllTransferRecord(ModelMap map ,String page, String token ,String  userName ,String stateValue,String toUserName,String code){
        String date="";
        try {
            date=transferService.getAllTransferRecord(map,page,token,userName,stateValue,toUserName, code);
        }catch (Exception e){
            e.printStackTrace();
            return CodeContent.getModelByCode(0,"转账记录获取失败",map);
        }

        return date;
    }
}
